﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApp1
{
    class Program
    {
        static int CalcStringHash(string str)
        {
            if (str == null)
                return 0;
            var loc0 = -2128831035;
            //var loc1 = 0;
            //while(loc1<str.Length)
            //{
            //    var c = str[loc1];
            //    var v = loc0 ^ c;
            //    loc0 = loc0 * v;
            //    loc1++;
            //}
            for (var i = 0; i < str.Length; i++)
            {
                var c = str[i];
                var v = c ^ loc0;
                loc0 = 16777619 * v;
            }
            return loc0;
        }
        static void Main(string[] args)
        {
            var hash = CalcStringHash("delete");
            Console.Write("hash=" + hash);
            Console.ReadLine();
        }
    }
}
